package com.ssy.lingxi.product.repository.warehouse;

import com.ssy.lingxi.product.entity.warehouse.Inventory;
import com.ssy.lingxi.product.entity.warehouse.Invoices;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public interface InventoryRepository extends JpaRepository<Inventory, Long> , JpaSpecificationExecutor<Inventory> {

    /**
    * 根据货号查询库存信息集合
    */
    List<Inventory> findAllByGoodsNoIn(Set<String> goodsIds);

    Inventory findByGoodsIdAndWarehouseIdEquals(Long goodsId,Long warehouseId);

    /**
    * 根据货号ID 和仓库ID查询库存
    */
    List<Inventory> findAllByGoodsIdInAndWarehouseIdEqualsAndMemberIdEquals(List<Long> goodsIds,Long warehouseId,Long memberId);

    List<Inventory> findAllByWarehouseIdIn(Set<Long> warehouseId);

    Inventory findFirstByGoodsIdAndWarehouseId(Long goodsId, Long warehouseId);

    List<Inventory> findAllByGoodsIdInAndWarehouseIdIn(List<Long> goodsIdList, List<Long> warehouseIdList);

    List<Inventory> findAllByIdIn(List<Long> ids);
}
